﻿@model DataAbstractorExample.Forms.CommentAdd
@{
    ViewBag.Title = "Note List";
}


<div class="navbar">
    <div class="navbar-inner">
        <div class="pull-right">
            @Html.ActionLink("Add New Note", "Add", null, new { @class = "btn btn-primary" })
        </div>
        <h4>Note List</h4>
    </div>
</div>

<hr />

@foreach (var note in ((DataAbstractorExample.Forms.NoteListView)ViewBag.Notes).Notes)
{
    <h3>
        @note.Created.ToString("d") - @note.Message
        @Html.ActionLink("Edit", "Edit", null, new { id = note.NoteId }, new { @class = "btn" })
        @Html.ActionLink("Remove", "Remove", null, new { id = note.NoteId }, new { @class = "btn btn-danger" })
    </h3>
    foreach (var comment in note.Comments)
    {
        <p><strong>@comment.From:</strong> @comment.Message @Html.ActionLink("[x]", "Remove", "Comment", new { id = comment.CommentId }, null)</p>
    }
    using (var form = Html.BeginForm("Add", "Comment", new { id = note.NoteId }, FormMethod.Post, new { @class = "form-inline" }))
    {
        <p>
            <i>From: </i>
            @Html.EditorFor(i => i.From)
            <i>Message: </i>
            @Html.EditorFor(i => i.Message)
            <input type="submit" value="Add" class="btn" />
        </p>
    }
    <hr />
}